Skip to content

Conversation

@Michael-A-McMahon
Copy link
Member

@Michael-A-McMahon Michael-A-McMahon commented Aug 29, 2023

This branch addresses the case where the common ForkJoinPool (FJP) has zero threads. This can occur with -Djava.util.concurrent.ForkJoinPool.common.parallelism=0, or in certain Kubernetes environments on certain versions of the JDK.
When this condition occurs, the result is brutal for our users. The system will simply hang without reporting any error. A jstack dump won't show any threads blocked either. The user will have no indication about it is causing the issue and how to fix it.
The fix will have Oracle R2DBC fallback to a single threaded ForkJoinPool if the common pool potentially has zero threads. Unfortunately, there is no simple way to distinguish between common FJP that has 1 thread or 0 threads. The getParallelism and getCommonPoolParallelism methods both return 1 when the FJP has 0 threads. They also return 1 when the FJP has 1 thread. So the fix will fall back to a single threaded FJP in either case.

Revised Fix:
Oracle R2DBC will only check for common.parallelism=0. This is the only valid way to have zero threads in the common pool.
Oracle R2DBC will not check for getCommonPoolParallelism()==1. That fix is only valuable when the JDK has a defect. The fix detract value for users who aren't using a defective JDK, as it unnecessarily allocates an additional thread.

@Michael-A-McMahon Michael-A-McMahon self-assigned this Aug 29, 2023
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Aug 29, 2023
@Michael-A-McMahon Michael-A-McMahon merged commit da33589 into main Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue with microservice using r2dbc oracle inside kubernetes cluster. (Request timeouts)

2 participants